package panier;

import entity.Produit;

public class CartItem {

    Produit product;
    short quantity;
    String name;

    public CartItem(Produit product) {
        this.product = product;
        quantity = 1;
    }

    public Produit getProduct() {
        return product;
    }

    public short getQuantity() {
        return quantity;
    }

    public void setQuantity(short quantity) {
        this.quantity = quantity;
    }

    public void incrementQuantity() {
        quantity++;
    }

    public void decrementQuantity() {
        quantity--;
    }

    public double getTotal() {
        double amount = 0;
        amount = (this.getQuantity() * product.getPrix());
        amount = Math.rint(amount*100)/100;
        return amount;
    }
    
    public double getTotalremise() {
        double amount = 0;
        amount = (this.getQuantity() * product.getPrix()*(100-product.getRemise())/100);
        amount = Math.rint(amount*100)/100;
        return amount;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
    
    
}